package com.xd.core.system.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

/**
 * <p>
 * 
 * </p>
 *
 * @author SJ
 * @since 2023-03-28
 */
@Data
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
@ApiModel(value="CityInfo对象", description="")
public class CityInfo implements Serializable {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "主键自增")
    private Integer id;

    @ApiModelProperty(value = "父类id")
    private Integer pid;

    @ApiModelProperty(value = "城市的名字")
    private String districtName;

    @ApiModelProperty(value = "城市所在省的名字")
    private String provinceName;

    @ApiModelProperty(value = "城市的类型，0是国，1是省，2是市，3是区")
    private Integer type;

    @ApiModelProperty(value = "地区所处的层级")
    private Integer hierarchy;

    @ApiModelProperty(value = "层级序列")
    private String districtSqe;

    @ApiModelProperty(value = "根0或叶1")
    private String flag;

    @ApiModelProperty(value = "行政编码")
    private String mapCode;

    @ApiModelProperty(value = "全称")
    private String extName;

    @TableField(exist = false)
    @ApiModelProperty(value = "是否可点击(true可点击，false不可点击)")
    private boolean clickFlag = true;

    @TableField(exist = false)
    @ApiModelProperty(value = "子级")
    private List<CityInfo> cityChild;

    public void addChild(CityInfo child) {
        if (this.cityChild == null)
            this.cityChild = new ArrayList<>();
        this.cityChild.add(child);
    }
}
